//package com.rest.demo.Service;
//
//import com.rest.demo.repository.PostDTO;
//import com.rest.demo.util.restUtil;
//import org.jsoup.Connection;
//import org.jsoup.Jsoup;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Service;
//import org.springframework.web.client.RestTemplate;
//
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.Map;
//
//@Service
//public class DemoService {
//
//    @Autowired
//    private restUtil XRestUtil;
//
//
//    @Autowired
//    private RestTemplate restTemplate;
//
//
//    public String getInfo(Integer id) {
//        return restTemplate.getForObject("http://t.weather.itboy.net/api/weather/city/" + id, String.class);
//    }
//
//
//    public PostDTO GetHtml() {
//        String res = "";
//        String Urla = "https://www.baidu.com/";
//        ResponseEntity<PostDTO> Htm = restTemplate.getForEntity(Urla, PostDTO.class);
//        return Htm.getBody();
//    }
//
//
//    public String getHttp() {
//        String url = "http://auths-test.dysmt.cn/oauth/authorize?client_id={client_id}&response_type={response_type}&grant_type={grant_type}&scope={scope}&redirect_uri={redirect_uri}";
//        //组装请求参数
//        Map<String, Object> parmMap = new HashMap<String, Object>();
//        parmMap.put("client_id", "057ffa4052294d45af9b9bac69dc4c8d");
//        parmMap.put("response_type", "code");
//        parmMap.put("grant_type", "authorization_code");
//        parmMap.put("scope", "snsapi_baseinfo");
//        parmMap.put("redirect_uri", "https://127.0.0.1/");
//        System.out.println(url);
//        String result = XRestUtil.get(url, parmMap);
//        System.out.println(result);
//        return result;
//    }
//
//
//    public String tyjson() throws IOException {
//        String client_id = "057ffa4052294d45af9b9bac69dc4c8d";
//        String response_type = "code";
//        String grant_type = "authorization_code";
//        String scope = "snsapi_baseinfo";
//        String redirect_uri = "https://127.0.0.1/";
//
//        String Url = "http://auths-test.dysmt.cn/oauth/authorize?client_id=" +
//                client_id + "&response_type=" +
//                response_type + "&grant_type=" +
//                grant_type + "&scope=" + scope +
//                "&redirect_uri=" + redirect_uri;
//        Connection.Response execute = Jsoup.connect(Url)
//                .followRedirects(false)
//                .method(Connection.Method.GET)
//                .execute();
//
//        return execute.headers("location").get(0);
//    }
//
//
//    public String Authi2() {
//
//        String client_id = "057ffa4052294d45af9b9bac69dc4c8d";
//        String response_type = "code";
//        String grant_type = "authorization_code";
//        String scope = "snsapi_baseinfo";
//        String redirect_uri = "https://127.0.0.1/";
//
//        String Url = "http://auths-test.dysmt.cn/oauth/authorize?client_id=" +
//                client_id + "&response_type=" +
//                response_type + "&grant_type=" +
//                grant_type + "&scope=" + scope +
//                "&redirect_uri=" + redirect_uri;
//
//       return restTemplate.getForObject(Url, String.class);
//
//    }
//
//
//}
